////////////////////////////////////////////////////////////////////////////////
//
//  Pixelami.com
//  Copyright 2011 Original Authors (Alexander Syed et al)
//  All Rights Reserved.
//
//  NOTICE: Pixelami permits you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

package org.pixelami.hercularity.conditions
{
	import flash.utils.describeType;
	
	
	public class Condition
	{
		public var hostObject:Object;
		public var methodName:String;
		
		public function Condition(hostObject:Object,methodName:String)
		{
			this.hostObject = hostObject;
			this.methodName = methodName;
		}
		
		public function get method():Function
		{
			return hostObject[methodName];
		}
		
		public function getInfo():String
		{
			var hostRefelction:XML = describeType(hostObject);
			var infoXML:XMLList = hostRefelction..method.(@name == methodName).metadata.(@name=="Condition").arg.(@key=="name").@value;
			
			return infoXML.toXMLString();
		}
	}
}